<template>
<div class="Home">
    <cu-custom bgColor="bg-gradual-blue">
        <block slot="content">{{title}}</block>
    </cu-custom>
    <swi-per></swi-per>
    <hea-der :recommends="recommends"></hea-der>
    <scrollvi-ew></scrollvi-ew>
    <ca-rd :num="num" @headeldetails="headeldetails"></ca-rd>
    <back-top :active="backtophome" v-if="isShow">
        <image style="width:80upx;height:80upx" mode="scaleToFill" src="https://www.ahlinghui.com/Uploads/image/20190429/images/BackTop.png" />
    </back-top>
</div>
</template>

<script>
import SwiPer from './Children/swiper'
import HeaDer from './Children/header'
import ScrollviEw from './Children/ScrollView'
import CaRd from '../../colorui/components/CaRd'
import {
    getHomeHelpInfo
} from '../../service/home.js'
export default {
    data() {
        return {
            title: '首页',
            isShow: false,
            backtophome: 'back-top_home',
            recommends: [{
                    image: 'https://www.ahlinghui.com/Uploads/image/20190429/images/namecard.png',
                    title: '名片'
                },
                {
                    image: 'https://www.ahlinghui.com/Uploads/image/20190429/images/supplier.png',
                    title: '外贸/机械'
                },
                {
                    image: 'https://www.ahlinghui.com/Uploads/image/20190429/images/vip.png',
                    title: '会员服务'
                },
                {
                    image: 'https://www.ahlinghui.com/Uploads/image/20190429/images/process.png',
                    title: '加工厂'
                },
                {
                    image: 'https://www.ahlinghui.com/Uploads/image/20190429/images/experts.png',
                    title: '专家服务'
                },
            ],
            num: []
        }
    },
    components: {
        SwiPer,
        HeaDer,
        ScrollviEw,
        CaRd
    },
    methods: {
        headeldetails(query) {
            uni.navigateTo({
                url:  `./details/details?lid=${query.lid}&lmobile=${query.lmobile}`
            });
			// uni.share({
			//     provider: "weixin",
			//     scene: "WXSenceTimeline",
			//     type: 1,
			//     summary: "我正在使用HBuilderX开发uni-app，赶紧跟我一起来体验！",
			//     success: function (res) {
			//         console.log("success:" + JSON.stringify(res));
			//     },
			//     fail: function (err) {
			//         console.log("fail:" + JSON.stringify(err));
			//     }
			// });
        },
    },
    mounted() {

        switch (uni.getSystemInfoSync().platform) {
            case 'android':
                console.log('运行Android上')
                break;
            case 'ios':
                console.log('运行iOS上')
                break;
            default:
                console.log('运行在开发者工具上')
                this.backtophome = 'back-top_home_wx'
                break;
				
        }
    },
    created() {
        getHomeHelpInfo('', '', 1, 'ALL').then(res => {
                if (res.data.data != '' || res.data.data != null) {
                    const data = res.data.data
                    this.num.push(...data)
                } else {

                }

            })
            .catch(err => {

            })

    },
    onPageScroll(Object) {
        this.isShow = Object.scrollTop > 600 ? true : false
    }
}
</script>

<style>
.Home {
    background-color: #eee;
}
</style>
